<template>
  <div class="app-container">
    <el-container>
      <el-header>
        <div class="header-content">
          <div class="logo">
            <router-link to="/">MCP Market</router-link>
          </div>
          <div class="nav-menu">
            <el-menu mode="horizontal" router :default-active="activeIndex">
              <el-menu-item index="/">首页</el-menu-item>
              <el-menu-item index="/categories">分类</el-menu-item>
            </el-menu>
          </div>
        </div>
      </el-header>
      <el-main>
        <router-view />
      </el-main>
      <el-footer>
        <div class="footer-content">
          <p>© {{ new Date().getFullYear() }} MCP Market</p>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      activeIndex: '/'
    }
  },
  watch: {
    $route: {
      handler(route) {
        this.activeIndex = route.path;
      },
      immediate: true
    }
  }
}
</script>

<style>
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
}

#app {
  height: 100%;
}

.app-container {
  height: 100vh;
}

.el-container {
  height: 100%;
}

.el-header {
  background-color: #409EFF;
  color: white;
  line-height: 60px;
  padding: 0 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
}

.el-main {
  background-color: #f8f8f8;
  padding: 20px;
}

.el-footer {
  background-color: #303133;
  color: #909399;
  text-align: center;
  line-height: 60px;
}

.footer-content {
  text-align: center;
}

.nav-menu .el-menu {
  background-color: transparent;
  border-bottom: none;
}

.nav-menu .el-menu-item {
  color: white;
}

.nav-menu .el-menu-item.is-active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.2);
}

.nav-menu .el-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
</style>